package com.smasher.dialog.bottomsheet;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;

import com.smasher.dialog.R;
import com.smasher.widget.base.BaseRecyclerViewHolder;

/**
 * @author HXZ_Android
 */
public class DialogBottomSheetViewHolder extends BaseRecyclerViewHolder<BeanDialogItem> {

    private final AppCompatImageView ivIcon;
    private final AppCompatTextView tvText;

    public DialogBottomSheetViewHolder(@NonNull View itemView) {
        super(itemView);
        ivIcon = itemView.findViewById(R.id.iv_icon);
        tvText = itemView.findViewById(R.id.tv_text);
    }

    @Override
    public void bindView() {
        super.bindView();
        if (mItem.getIcon() != null) {
            ivIcon.setVisibility(View.VISIBLE);
            ivIcon.setImageDrawable(mItem.getIcon());
        } else {
            ivIcon.setVisibility(View.GONE);
        }
        tvText.setText(mItem.getName());
    }

}
